<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%String path = request.getContextPath() ;%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %> 
<!DOCTYPE html>
<html lang="zh-CN" >
<head>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>
<jsp:include page="../../import.jsp" flush="true" />
<style type="text/css">
</style>
</head>
<body class="iframeBody">
<div class="Wrapper">
     <div class="fieldset1 tabel_col tabel_col_s clearFix">
        <div class="caption">
			<span class="title">超额抵押基本信息</span>
		</div>
		<div class="fieldBox col_33">
		   <div class="label">项目名称</div>
		   <div class="field">
              <span>${vo.fncPrjNm}</span>
           </div>
		</div>
		<div class="fieldBox col_33">
		   <div class="label">项目编号</div>
		   <div class="field">
              <span id="fncPrjId" >${vo.fncPrjId}</span>
           </div>
		</div>
		<div class="fieldBox col_33">
		   <div class="label">融资机构</div>
		   <div class="field">
              <span id="fncInsNm" >${vo.fncInsNm}</span>
           </div>
		</div>
		<div class="fieldBox col_33">
		   <div class="label">已付超额抵押</div>
		   <div class="field">
              <span >${vo.paidUpAmt/100}</span> 
           </div>
		</div>
		<%-- <div class="fieldBox col_33">
		   <div class="label">付款时间</div>
		   <div class="field">
             <span id="payTm">${vo.payPd}</span> 
           </div>
		</div> --%>
		<div class="fieldBox col_33">
		   <div class="label">期次</div>
		   <div class="field">
             <span id="payTm">${vo.payPd}</span> 
           </div>
		</div>
		<div class="fieldBox col_33">
		   <div class="label">剩余金额</div>
		   <div class="field">
		     <span id="srplsMrgn">${vo.surplusMoney/100}</span>
           </div>
		</div>
		<div class="fieldBox col_33">
		   <div class="label">付款时间</div>
		   <div class="field">
		     <span id="actPymtAmt"></span>
           </div>
		</div>
		<!-- 当前盈余=历史退回金额-已付超额抵押 -->  
		<div class="fieldBox col_50">
			<div class="label"><font color="red"><b>当前盈余</b></font></div>
            <div class="field">
            	<span id="surplus"></span>
            </div>
		</div>
	 </div><br/>
	
	<div class="caption">
			<span class="title">超额抵押退回记录</span>
	</div>
	<div class="fieldBox col_100">
		<div style="width: 98%; margin-left: 1%;">
			<div id="returnRecordPage" class="sq-grid"></div>
		</div>
	</div>
	
</div>

<script type="text/javascript">
   $(function() {
	
	   returnRecordPage();
	   
	   //计算当前盈余
	   var hisTransAm = (!"${vo.hisTransAm}")? 0 : new Number("${vo.hisTransAm/100}");
	   var paidUpAmt = (!"${vo.paidUpAmt}")? 0 : new Number("${vo.paidUpAmt/100}");
	   var surplus = 0;
	   //if(hisTransAm!='' && paidUpAmt!=''){
			surplus = parseFloat(hisTransAm) - parseFloat(paidUpAmt);
	   //}
	   $("#surplus").html(surplus);
	   
	   var actPymtAmt = renderDateChange('${vo.actPymtAmt}');
	   $("#actPymtAmt").html(actPymtAmt);
	   
	 });
   
 

	  function f_getDetailData(listChange)
	  {
	      var data = { Rows: [] };
	      for (var i = 0; i < listChange.length; i++)
	      {
	         data.Rows.push(listChange[i]);
	      }
	      return data;
	  }
	  
	  //显示退回记录
	  function returnRecordPage()
	  { 
		  $("#returnRecordPage").ligerGrid({
		    	url:'<%=path%>/rfbuss/fnovercollinfo/returnRecordPage.do?id=${vo.id}',
				method:'get',
				columns:[
				            { display: '到账日期', name: 'TRANS_TM_' }, 
				            { display: '退回金额', name: 'TRANS_AM' }, 
				            { display: '不可退回金额', name: 'TRANS_AM_NO_RETURN' }, 
				            { display: '收款银行', name: 'TRANS_BANK' }, 
				            { display: '收款账号', name: 'ACC_NO', render: function (rowdata, rowindex, value){
			                	 var h="";
			                	  h='<a class="sq-button-hasicon" href="javascript:myAccNo(';
			                      h+="'"+rowdata.TRANS_ACC+"'";
			                      h+=')">'+rowdata.ACC_NO+'</a>'
			                    
			                    return h;
			                }}, 
						],
				
			    enabledEdit: false,
				usePager: true,//是否有分页便签
				isScroll: true,//是否有滚动条
				root:'rows',
				record:'total',
				hideLoadButton:false,
				width:'100%',
				height:300,
				heightDiff:-2,
				//checkbox:true,//列表是否有选择框
				rownumbers:true,//列表是否有行号
				//selectRowButtonOnly:true,//复选框模式时，是否只允许点击复选框才能选择行
			});
		  
		   
	  }
	  
		 //显示我司账户信息
		 function myAccNo(accId) {
			 if(accId) {
		    		$.ligerDialog.SQopen({
		                url: '<%=path%>/system/sysBkAccInfo/myAccNoDetail.do?id='+accId,
		                width: 600,
		                height:250,
		                title : '我司账户信息',
		                buttons: [{
		    	                text: "关闭", type: 'cancel', cls: 'l-dialog-btn-ok',
		    	                onclick: function (item, Dialog) {
		    	                    if (Dialog.onCancel) Dialog.onCancel();
		    	                }
		    	            }
		    	        ]
		    		});
		    	}
		 }
    
 //格式化时间
 function renderDateChange(value){
	var dateStr = "";
	if(null != value &&  ""!= value){
		var date = new Date(value);
		dateStr = DateUtils.formatDate(date, DateUtils.YYYY_MM_DDHHMMSS);
	}
	return dateStr;
 } 
 
 //格式化时间
 function renderDate(rowdata, index, value){
	var dateStr = "";
	if(null != value){
		var date = new Date(value);
		dateStr = DateUtils.formatDate(date, DateUtils.YYYY_MM_DDHHMMSS);
	}
	return dateStr;
 }
 
//格式化null
 function renderNull(rowdata, index, value){
	var dateStr = "";
	if(null != value){
		 dateStr = value;
	}
	return dateStr;
 }
 
 //格式化金额
 function moneyChange(value) { 
		var h = '';
			if(value&&value!="null"){
		    h+=fmoney(value, 2);
			}else{
			h+="0.00";
			}
         return h;
		}
 
 //格式化金额
 function fmoney(s, n)   
	{   
	   n = n > 0 && n <= 20 ? n : 2;   
	   s = parseFloat((s + "").replace(/[^\d\.-]/g, "")).toFixed(n) + "";   
	   var l = s.split(".")[0].split("").reverse(),   
	   r = s.split(".")[1];   
	   t = "";   
	   for(i = 0; i < l.length; i ++ )   
	   {   
	      t += l[i] + ((i + 1) % 3 == 0 && (i + 1) != l.length ? "," : "");   
	   }   
	   return t.split("").reverse().join("") + "." + r;   
	} 
</script>
</body>
</html>
